package com.sumainfor.zuul.controller;

import com.sumainfor.zuul.util.JwtHelper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Eddy·Chen
 * @Email 835033913@qq.com
 * @Create 2019-06-14 10:39
 */
@RestController
@RequestMapping("test/jwt")
public class TestTokenController {

    @Autowired
    private JwtHelper jwtHelper;


    /**
     * 测试 获取Token
     *
     * @param main
     * @return
     */
    @RequestMapping("/getToken/{main}")
    public String getToken(@PathVariable("main") String main) {
        if (StringUtils.isBlank(main)) {
            return "参数不完整";
        }
        return jwtHelper.generateTokenJwt(main);
    }

}
